# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Arto Kitula <arto.kitula@gmail.com>

pkgname=libgpg-error
pkgver=1.38
pkgrel=0
pkgdesc="Support library for libgcrypt"
url="http://www.gnupg.org"
arch="all"
license="GPL-2.0-or-later LGPL-2.1-or-later"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc $pkgname-lisp:lisp:noarch"
makedepends="automake autoconf"
source="https://gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-$pkgver.tar.bz2"

prepare() {
	default_prepare
	aclocal
	automake
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-static \
		--disable-nls
	make
}

check() {
	make -C "$builddir" check
}

package() {
	make -j1 DESTDIR="$pkgdir" install
}

lisp() {
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/share/
}

static() {
	pkgdesc="$pkgnanme static libraries"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
}

sha512sums="b936a4738c2cee111d855b1ba3ec433da8c77799a87d1f71275f974f871ebfa593c9db06ea53f0490b6cd6b94bef34f6052a587a4d13d839ec0128500c2dd9de  libgpg-error-1.38.tar.bz2"
